FreeCAD verwendet Git zur Verwaltung des Quellcodes. Dieses Dokument ist eine oberflächliche Einführung in GitKraken, eine grafische Benutzeroberfläche von Git. GitKraken ist eine proprietäre Software, die für den nicht kommerziellen Gebrauch kostenlos ist; du brauchst GitKraken nicht, um Code für FreeCAD zu entwickeln, aber viele Entwickler mögen es und finden es nützlich, ihre Entwicklung zu verwalten. FreeCAD unterstützt GitKraken nicht, aber wir hoffen, dass ein Leitfaden wie dieser den Anwendern zeigt, wie einfach es ist, die Entwicklungsumgebung einzurichten, und ermutigt mehr Menschen, sich zu beteiligen.
Weitere Informationen zur allgemeinen Git Nutzung über die Befehlszeile findest Du unter Source code management und im Online Buch Pro Git. Zur Kompilierung von FreeCAD siehe Kompilieren.
Git ist ein leistungsfähiges Revisionskontrollsystem, das häufig verwendet wird, um die Entwicklung von Computercode zu verfolgen. Obwohl es sich um ein komplexes System handelt, benötigst Du in der Regel nur einige Hintergrundinformationen über die Funktionsweise und einige wenige Terminalbefehle. Eine grafische Benutzeroberfläche (GUI) erleichtert die Lernkurve. GitKraken ist ein proprietäres Programm, das für den nicht kommerziellen Gebrauch kostenlos ist und auf dem Gerüst Electron läuft, d.h. es ist plattformübergreifend und kann unter Linux, MacOS und Windows gleichermaßen verwendet werden.
Es gibt unterschiedliche Wege zum Herunterladen von GitKraken, abhängig von Deinem Betriebssystem. In Linux Distributionen kann man es manchmal über den Paketmanager beziehen.
https://github.com/FreeCAD/FreeCAD
.FreeCAD/FreeCAD
repository to your own account. In other words the URL to access your fork will be:
https://github.com/GITHUBUSERNAME/FreeCAD.git
git klonen
.
Please read the difference between origin vs. upstream remote repository. Essentially, your fork of FreeCAD is the origin
repository, while the official FreeCAD repository is upstream
. You now need to set the upstream accordingly.FreeCAD/FreeCAD
and click on it. In the Name field, type upstream
. Then click the Add Button.master
branch so you switch to it. In the command line, this is equivalent to
git checkout master
Für weitere Informationen konsultiere GitKraken Erste Schritte Leitfaden.
Local master | Your local branch of the FreeCAD master branch, indicated by the blue line in the screenshot.
The item is highlighted in green, meaning that the branch is currently active ( |
Local <branch-name> | Any other branches on your local machine. In the screenshot you can see branches called editor_fixes and editor_fixes_typos
|
Remote upstream | The official FreeCAD repository https://github.com/FreeCAD/FreeCAD , indicated by the green line in the screenshot.
|
Remote origin | Your personal fork of FreeCAD, https://github.com/YourGitHubUsername/FreeCAD , indicated by the red line in the screenshot.
|
GitKraken interface showing three local branches including a local master, and remote origin
and upstream
repositories, each of which have a master and release branches.
In the image, the remote the Local master and Remote origin master branches are three commits behind the Remote upstream master, that is, the official FreeCAD source code. This is indicated by the icons being three steps behind in the chain that represents the commit history of the master branch. See Rebasing to update the branches that are behind.
git checkout master
)git pull upstream master
)git push origin master
). This pushes from your Local master to the Remote origin master.Rebasing a local master updates it so that it matches the contents of the upstream master.
Branches are a feature that makes Git powerful compared to other revision systems. Branches aren't complete forks, but rather define snapshots where a version of the code starts diverging from the master branch. Whenever you want to modify the FreeCAD code, first create a branch, then make changes, and then merge your commits back to the master branch. With Git it is simple to create, merge and delete branches when you no longer need them. Please read Branching and Merging to understand more about this process in GitKraken.
git checkout master
). In GitKraken the Local master branch should be highlighted in green.git checkout -b new-name-of-your-branch
).
Pull requests (PRs) are necessary to merge the code in a branch in your local repository with the code in the upstream
repository. To summarize the process, once you've modified your branch, you need to push it to your GitHub fork (origin
, https://github.com/GITHUBUSERNAME/FreeCAD.git
), and from there make a pull request to upstream
. GitKraken saves you some clicks to easily create pull requests instead of using GitHub's interface.
Steps in GitKraken:
GITHUBUSERNAME/FreeCAD
) to the remote upstream master branch (FreeCAD/FreeCAD
). Be sure to enter a good title for the pull request, and write a more descriptive paragraph if your changes are significant. Consult the official documentation of GitKraken for more information.
GitKraken has a special merge conflict tool that is only accessible in the GitKraken Pro version. However, there are workarounds to use external tools for merging.
~/.gitconfig
in your user's home directory.As a revision control system Git encourages making many commits to keep track of your changes; however, if you have too many small changes the commit history may look a bit messy. Squashing is condensing various commits into only one commit. From the GitKraken manual, squashing is available for commits that meet the following requirements:
If all these conditions are met, the Squash option appears when you right click the commit node. See Squash.gif
You can use GitKraken to follow the personal FreeCAD forks of other developers; in this way you can see how they write code and commit changes to their own branches before they submit pull requests to the upstream FreeCAD/FreeCAD
repository.
Now whenever new commits are made, or branches are rebased, by the authors of those repositories, you will see their commit history in a graphical way.